package com.example.truthordare;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;

import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.Toast;

public class Setting extends Activity {

	int lv = 1;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_setting);
		final CheckBox ckclear = (CheckBox) findViewById(R.id.chbClear);
		final CheckBox ckdirty = (CheckBox) findViewById(R.id.chb_dirty);
		final CheckBox ckspdirty = (CheckBox) findViewById(R.id.chb_spdirty);
		Button btok = (Button) findViewById(R.id.button1);

		btok.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub

				if (ckdirty.isChecked()) {
					lv = 2;
				}
				if (ckspdirty.isChecked()) {
					lv = 3;
				}
				Toast.makeText(getApplicationContext(), "level " + lv,
						Toast.LENGTH_SHORT).show();
				final int send =lv;
				Bundle sendBundle = new Bundle();
				sendBundle.putInt("lv", send);
				Log.i("setting send", ""+send);
				Intent i = new Intent();
				i.putExtras(sendBundle);
				setResult(RESULT_OK,i);
				finish();
			}
		});

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.setting, menu);
		return true;
	}

}
